from selenium import webdriver
import time 
driver = webdriver.Chrome()
driver.get('https://www.jianshu.com/sign_in')
time.sleep(3)



# document.getElementsById()
# 定位注册按钮
# document.getElementsByClassName()[0]
# 定位登录按钮,表示获取第一个元素,可缺省.
# document.getElementsByTagName()[x]
# 定位账号文本框,表示获取页面第x个该元素,可缺省.
# document.getElementsByTagName()[x].value="abcdefg"
# 对定位的页面元素进行输入.


js_register='document.getElementById("js-sign-up-btn").click();'
driver.execute_script(js_register)
time.sleep(5)

js_login='document.getElementsByClassName("active")[0].click();'
driver.excute_script(js_login)
time.sleep(2)

js_input='document.getElementsByTagName("input")[2].value="username";'
driver.execute_script(js_input)
time.sleep(2)

js_passwd='document.getElementsByTagName("intpu")[3].value="pasword";'
driver.execute_script(js_passwd)
time.sleep(3)








driver.quit()